//
//  warningDetailViewController.m
//  WHB_logist
//
//  Created by 徐国庆 on 15/12/2.
//  Copyright (c) 2015年 turing. All rights reserved.
//

#import "warningDetailViewController.h"
#import "warningDetailCell.h"

@interface warningDetailViewController ()<UITableViewDataSource, UITableViewDelegate>

@property(nonatomic, strong)UITableView *tableView;
@property(nonatomic, strong)NSString *titlel;

@end

@implementation warningDetailViewController

- (instancetype)initWithTitle:(NSString *)title{
    self = [super init];
    if (self) {
        _titlel = title;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navtitle.text = self.titlel;
    [self initWithView];
    NSLog(@"zhangsan");
}


#pragma mark UITableViewDelegate

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kUIScreenWidth, 50)];
    timeLabel.text = @"2015-08-09    17:20";
    timeLabel.font = [UIFont systemFontOfSize:15];
    timeLabel.textColor = [UIColor HexStrWithColor:@"3C3C3C"];
    timeLabel.backgroundColor = [UIColor HexStrWithColor:@"F0F0F0"];
    timeLabel.textAlignment = 1;
    timeLabel.layer.borderWidth = 0.5;
    timeLabel.layer.borderColor = [UIColor blackColor].CGColor;
    
    return timeLabel;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 10;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString * indentifer = @"warningDetail";
    
    warningDetailCell *cell = (warningDetailCell *)[tableView dequeueReusableCellWithIdentifier:indentifer];
    if (!cell){
        cell=[[NSBundle mainBundle] loadNibNamed:@"warningDetail" owner:self options:nil][0];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.selectedBackgroundView.backgroundColor = [UIColor clearColor];
    
    cell.time.text = @"2015-08-09    17:20";
    cell.time.layer.borderWidth = 0.5;
    cell.time.textAlignment = 1;
    cell.time.textColor = [UIColor HexStrWithColor:@"3C3C3C"];
    cell.time.backgroundColor = [UIColor HexStrWithColor:@"F0F0F0"];
    cell.time.layer.borderColor = [UIColor HexStrWithColor:@"ADADAD"].CGColor;
    
    cell.desc.text = @"车辆粤B12345已经连续驾驶超过4个小时，王小二，13845687545请知悉";
    cell.desc.textAlignment = 1;
    cell.desc.numberOfLines = 0;
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}

- (void)initWithView{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kUIScreenWidth, kUIScreenHeight - kNavHeight) style:UITableViewStylePlain];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.tableView];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
